<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>${filename}</title>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery"></t:base>
<script type="text/javascript"
	src="video/ckplayer_6/ckplayer/ckplayer.js" charset="utf-8"></script>
<body>
<div id="a1"></div>
</body>
<script type="text/javascript" src="video/ckplayer_6/ckplayer/ckplayer.js" charset="utf-8"></script>
<script type="text/javascript">
	function loadedHandler() {
		if (CKobject.getObjectById('ckplayer_a1').getType()) {
			addPlayListener();
		} else {
			addPlayListener();
		}
	}
	function timeHandler(t) {
		if (t > -1) {
			SetCookie("Time", t);
		}
	}
	function addPlayListener() {//增加播放监听
		if (CKobject.getObjectById('ckplayer_a1').getType()) {//说明使用html5播放器
			CKobject.getObjectById('ckplayer_a1').addListener('play',
					playHandler);
		} else {
			CKobject.getObjectById('ckplayer_a1').addListener('play',
					'playHandler');
		}
	}
	function playHandler() {
		//alert('因为注册了监听播放，所以弹出此内容，删除监听将不再弹出');
		removePlayListener();
		CKobject.getObjectById('ckplayer_a1').videoSeek(getCookie("Time"));
		addTimeListener();
	}
	function removePlayListener() {//删除播放监听事件
		if (CKobject.getObjectById('ckplayer_a1').getType()) {//说明使用html5播放器
			CKobject.getObjectById('ckplayer_a1').removeListener('play',
					playHandler);
		} else {
			CKobject.getObjectById('ckplayer_a1').removeListener('play',
					'playHandler');
		}
	}
	function addTimeListener() {//增加时间监听
		if (CKobject.getObjectById('ckplayer_a1').getType()) {//说明使用html5播放器
			CKobject.getObjectById('ckplayer_a1').addListener('time',
					timeHandler);
		} else {
			CKobject.getObjectById('ckplayer_a1').addListener('time',
					'timeHandler');
		}
	}
	//写cookies函数
	function SetCookie(name, value)//两个参数，一个是cookie的名子，一个是值
	{
		var Days = 30; //此 cookie 将被保存 30 天
		var exp = new Date(); //new Date("December 31, 9998");
		exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000);
		document.cookie = name + "=" + escape(value) + ";expires="
				+ exp.toGMTString();
	}
	function getCookie(name)//取cookies函数
	{
		var arr = document.cookie.match(new RegExp("(^| )" + name
				+ "=([^;]*)(;|$)"));
		if (arr != null)
			return unescape(arr[2]);
		return null;
	}
	var flashvars = {
		f : 'http://movie.ks.js.cn/flv/other/2014/06/20-2.flv',
		c : 0,
		p : 2,
		b : 0,
		i : '/static/images/letitgo.jpg',
		loaded : 'loadedHandler',
		my_url : encodeURIComponent(window.location.href)
	};
	var params={bgcolor:'#FFF',allowFullScreen:true,allowScriptAccess:'always',wmode:'transparent'};
 	CKobject.embedSWF('video/ckplayer_6/ckplayer/ckplayer.swf','a1','ckplayer_a1','700','500',flashvars,params);
</script>
</html>